<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        button {
            display: inline-flex;
            justify-content: center;
            align-items: center;
            line-height: 1;
            height: 32px;
            white-space: nowrap;
            cursor: pointer;
            color: #fff;
            text-align: center;
            box-sizing: border-box;
            outline: none;
            transition: .1s;
            font-weight: 500;
            user-select: none;
            vertical-align: middle;
            background-color: #409eff;
            border: 1px solid #409eff;
            border-color: #409eff;
            padding: 8px 15px;
            font-size: 16px;
            border-radius: 6px;
            position: absolute;
            left: 54%;
            width: 400px;
            height: 46px;
            top: 50%;
        }
        .el-input__wrapper {
            display: inline-flex;
            flex-grow: 1;
            align-items: center;
            justify-content: center;
            padding: 1px 11px;
            background-color: #fff;
            background-image: none;
            border-radius: 12px;
            cursor: text;
            position: absolute;
            left: 53%;
            top: 40%;
            border: 1px solid #ddd;
        }
        input {
            --el-input-inner-height: 30px;
            width: 200px;
            color: #303133;
            font-size: 16px;
            height: 30px;
            line-height: 30px;
            border-radius: 8px;
            padding: 0;
            outline: none;
            border: none;
            background: none;
            box-sizing: border-box;
        }
        *{
            padding: 0;
            margin: 0;
        }
        .wrapper{
            height: 100vh;
            width: 100%;
            background-image: url(./resource/bg.png);
            background-size: cover;
        }
    </style>
</head>
<body>
    <div class="wrapper">
        <div class="el-input__wrapper">
            <input placeholder="输入链接" style="width: 400px;height: 40px;" value="" name="link"></input>
        </div>
        <button onclick="enterHandler()">进入</button>
    </div>
</body>
<script>
const btnDom = document.querySelector('button')
const iptDom = document.querySelector('input')
const urlReg = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)/;

function enterHandler() {
    if(!urlReg.test(iptDom.value)){
        alert('请输入https://类似的完整链接!')
        return;
    }
    localStorage.setItem('link',iptDom.value)
    window.location.replace(iptDom.value)
}
// if(localStorage.getItem('link')){
//     window.location.replace(localStorage.getItem('link'))
// }
</script>
</html>